<?php

namespace App\Http\Controllers\Admin;

use Illuminate\Http\Request;
use App\Http\Controllers\Controller;
use App\Models\System;

class SystemController extends Controller
{
    /**
     * Display a listing of the resource.
     *
     * @return \Illuminate\Http\Response
     */
    public function index()
    {
        $data = System::first();        
        return view('admin.system.edit',compact('data'));
    }

    
    public function update(Request $request, $id)
    {
        $rs['status'] = false;
        $rs['msg'] = '操作失败';
        $data = $request->only('agent_rate');
        $flag = System::where(['id'=>$id])->update($data);
        if($flag) {
            $rs['msg'] = '操作成功';
            return redirect('zadmin/systems')->with('rs',$rs);    
        } 
        return back();
        
    }

    
}
